﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZP.DTO.ep_personnel_info;
using ZP.IBLL;
using ZP.Model;

namespace ZP.BLL
{
    public class ep_personnel_infoService : BaseService<ep_personnel_info, int>, Iep_personnel_infoService
    {
        public List<ep_personnel_infoResultDTO> GetEnterprisePersonnalInfo(int ep_id)
        {
            var psie = (ZPJ_Entities)_repository.GetDbContext();
            var iquery = psie.ep_personnel_info.AsNoTracking().Where(p => p.ep_id == ep_id);

            //序列化类型为“System.Data.Entity.DynamicProxies.xxxx”的对象时检测到循环引用。 加上这个就OK了
            psie.Configuration.ProxyCreationEnabled = false;
            List<ep_personnel_infoResultDTO> list = AutoMapper.Mapper.Map<List<ep_personnel_infoResultDTO>>(iquery.ToList());
            return list;
        }
    }
}
